<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>${member.name}:我的流浪书屋</title>
		<link type="text/css" rel="stylesheet" href="css/MySpace.css">
		<script type="text/javascript">
		function checkSubmit() {
		
			var flag = true;
			var oldPw = document.getElementById("oldpassword");
			var pw = document.getElementById("password");
			var pwc = document.getElementById("passwordCheck");
			
			if (oldPw.value.length == 0) {
				flag = false;
				document.getElementById("oldPwSpan").innerHTML = "旧密码不能为空";
				oldPw.style.backgroundColor = "#CCCCCC";
			}
			 else if (pw.value.length == 0) {
			 	flag = false;
				document.getElementById("pwSpan").innerHTML= "密码不能为空";
				pw.style.backgroundColor = "#CCCCCC";
			
			}
			else if (pwc.value.length == 0) {
				flag = false;
				document.getElementById("pwcheckSpan").innerHTML = "密码确认不能为空";
				pwc.style.backgroundColor = "#CCCCCC";
				
			}
			else if(pwc.value!=(pw.value)){
				flag=false;
				document.getElementById("pwSpan").innerHTML = "两次输入的密码不相同";
				document.getElementById("pwcheckSpan").innerHTML = "两次输入的密码不相同";
				pwc.style.backgroundColor = "#CCCCCC";
				pw.style.backgroundColor = "#CCCCCC";
			}else if(oldPw.value!=document.getElementById("oldpwcheck").value){
			flag = false;
				document.getElementById("oldPwSpan").innerHTML = "密码输入错误";
				oldPw.style.backgroundColor = "#CCCCCC";
			}
			return flag;
		}
</script>
	</head>
	<body>

		<%@  include file="top.jsp"%>
		<div id="MIDDLE">
			<!--左侧-->
			<div id="LEFT">
				<div class="leftTitle">
					流浪书屋
				</div>
				<div class="leftContent">
					<ol>
						<li>
							<a href="${CONTEXT_ROOT}/OrderServlet?method=boughtList">购买过的书</a>
						</li>
						<li>
							<a href="${CONTEXT_ROOT}/shoppingCart.jsp">我的购物车</a>
						</li>
					</ol>
				</div>
				<div class="leftTitle">
					我的资料

				</div>
				<div class="leftContent">
					<ol>
						<li>
							<a href="${CONTEXT_ROOT}/MySpaceServlet?method=info">个人信息</a>
						</li>
						<li>
							<a href="${CONTEXT_ROOT}/MySpaceServlet?method=preupdateInfo">修改资料</a>
						</li>
						<li>
							<a href="${CONTEXT_ROOT}/MySpaceServlet?method=preupdatepw">修改密码</a>
						</li>
					</ol>
				</div>
				<div class="leftTitle">
					图书订单

				</div>
				<div class="leftContent">
					<ol>
						<li>
							<a href="${CONTEXT_ROOT}/OrderServlet?method=orderList">订单列表</a>
						</li>
						<li>
							<a href="#"> 退货申请</a>
						</li>
					</ol>
				</div>

				<div class="leftTitle">
					我的帐户
				</div>
				<div class="leftContent">
					<ol>
						<li>
							<a href="#">我的积分</a>
						</li>
						<li>
							<a href="#"> 我的优惠券</a>
						</li>
					</ol>
				</div>
				<div class="leftTitle">
					个性定制

				</div>
				<div class="leftContent">
					<ol>
						<li>
							<a href="#">私人空间 </a>
						</li>
						<li>
							<a href="#"> 兴趣 </a>
						</li>
					</ol>
				</div>
			</div>
			<!--右侧-->
			<div id="RIGHT">

				<!-- 买过的书 -->
				<div id="RIGHT">
					<div
						style="width: 562px; float: left; text-align: left; height: 28px; font-size: 14px; vercial-align: middle;">
						流浪书屋--修改密码
					</div>
					<div style="float: left; font-size: 13px; width: 100px;">

						<a href="javascript:history.go(-1);">返回</a>

					</div>
					<form action="${CONTEXT_ROOT}/MySpaceServlet" method="post"
						onsubmit="return checkSubmit()">
						<input type="hidden" value="updatepw" name="method">
<input type="hidden" name="oldpwcheck" value="${member.password}">
						<table width="600px" cellspacing="0" cellpadding="0" border="0"
							style="font-size: 14px; line-height: 35px; text-align: center; margin-top: 20px;">
							<tr>
								<td width="25%">

									<table width="100%" cellspacing="0" cellpadding="0" border="1"
										bordercolor="#ffffff" bgcolor="#CAE8EA">
										<tr>
											<td align="right">
												旧密码&nbsp;&nbsp;
											</td>

										</tr>
										<tr>
											<td align="right">
												新密码&nbsp;&nbsp;
											</td>
										</tr>
										<tr>
											<td align="right">
												密码确认&nbsp;&nbsp;
											</td>
										</tr>

									</table>
								</td>
								<td width="75%">
									<table width="100%" cellspacing="0" cellpadding="0" border="1"
										bordercolor="#ffffff" bgcolor="#CDE5FD">
										<tr>
											<td align="left">
												&nbsp;&nbsp;
												<input type="password" name="oldpassword" id="oldpassword"
													size="28">
												<font color="red"><span id="oldPwSpan"></span> <c:if
														test="${not empty msg1}">
														<img src='images/error.gif' width='14' height='14' />${msg1}</c:if>
												</font>
											</td>
										</tr>
										<tr>
											<td align="left">
												&nbsp;&nbsp;
												<input type="password" name="password" id="password"
													size="28">
												<font color="red"><span id="pwSpan"></span> </font>
											</td>
										</tr>
										<tr>
											<td align="left">
												&nbsp;&nbsp;
												<input type="password" name="passwordCheck"
													id="passwordCheck" size="28">
												<font color="red"><span id="pwcheckSpan"></span> </font>
											</td>
										</tr>

									</table>
								</td>
							</tr>
							<tr>
								<td></td>
								<td align="left">
									&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="submit" value="修改" name="button">
									&nbsp;&nbsp;
									<input type="reset" value="重置" name="button">
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
		<%@  include file="bottom.jsp"%>
	</body>
</html>